package com.ymatou.c2cliveindexer.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.c2cliveindexer.parameter.LiveindexerBean;
import com.ymatou.c2cliveindexer.service.LiveindexerCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;

/**
 * c2clive重建索引接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_Liveindexer {
	private static LiveindexerBean liveindexerBean;
	private static LiveindexerCall liveindexerCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("c2clive重建索引接口");
	}

	@Before
	public void caseUp() {
		liveindexerBean = new LiveindexerBean();
		liveindexerCall = new LiveindexerCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(liveindexerCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_Liveindexer_001() {
		Logger.start(true,"重建索引接口成功");
		try {
			liveindexerBean.setAction("reload");
			liveindexerCall.setData(liveindexerBean);
			liveindexerCall.callService();
			Logger.debug("发送报文:" + liveindexerCall.getEntityString());
			Logger.debug("返回报文:" + liveindexerCall.getReturnData());
			Logger.verifyEquals("OK", liveindexerCall.getStatus(), "验证返回状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}